ARG JAVA_WORKER_BASE_IMAGE_VERSION=2.2.2

FROM scratch as builder
WORKDIR /app
ADD airbyte-app.tar /app

FROM airbyte/airbyte-base-java-worker-image:${JAVA_WORKER_BASE_IMAGE_VERSION}

ENV APPLICATION airbyte-workload-launcher
ENV VERSION ${VERSION}
# 8016 is the port micronaut listens on
# 5005 is the remote debug port
EXPOSE 8016 5005

WORKDIR /app
COPY --chown=airbyte:airbyte --from=builder /app /app
USER airbyte:airbyte

ENTRYPOINT ["/bin/bash", "-c", "airbyte-app/bin/${APPLICATION}"]
